@@ -9,7 +9,8 @@ from django_response import response  | 
            ||
| 9 | 9 | 
                from paginator import pagination  | 
            
| 10 | 10 | 
                 | 
            
| 11 | 11 | 
                from account.models import UserInfo  | 
            
| 12 | 
                -from member.models import (CouponInfo, GoodsInfo, GoodsOrderInfo, MemberActivityInfo, MemberActivitySigninInfo,  | 
            |
| 12 | 
                +from coupon.models import UserCouponInfo  | 
            |
| 13 | 
                +from member.models import (GoodsInfo, GoodsOrderInfo, MemberActivityInfo, MemberActivitySigninInfo,  | 
            |
| 13 | 14 | 
                MemberActivitySignupInfo, RightInfo)  | 
            
| 14 | 15 | 
                from utils.error.errno_utils import (MemberActivityStatusCode, MemberGoodStatusCode, MemberRightStatusCode,  | 
            
| 15 | 16 | 
                UserStatusCode)  | 
            
                @@ -215,7 +216,7 @@ def coupons(request):  | 
            ||
| 215 | 216 | 
                     page = request.POST.get('page', 1)
               | 
            
| 216 | 217 | 
                     num = request.POST.get('num', 20)
               | 
            
| 217 | 218 | 
                 | 
            
| 218 | 
                -    coupons = CouponInfo.objects.filter(user_id=user_id, status=True).order_by('-pk')
               | 
            |
| 219 | 
                +    coupons = UserCouponInfo.objects.filter(user_id=user_id, status=True).order_by('-pk')
               | 
            |
| 219 | 220 | 
                coupons, left = pagination(coupons, page, num)  | 
            
| 220 | 221 | 
                coupons = [coupon.data for coupon in coupons]  | 
            
| 221 | 222 | 
                 | 
            
                @@ -8,7 +8,8 @@ from django_six import CompatibilityBaseCommand, close_old_connections  | 
            ||
| 8 | 8 | 
                from TimeConvert import TimeConvert as tc  | 
            
| 9 | 9 | 
                 | 
            
| 10 | 10 | 
                from account.models import UserInfo  | 
            
| 11 | 
                -from member.models import CouponInfo, RightInfo  | 
            |
| 11 | 
                +from coupon.models import UserCouponInfo  | 
            |
| 12 | 
                +from member.models import RightInfo  | 
            |
| 12 | 13 | 
                from utils.redis.connect import r  | 
            
| 13 | 14 | 
                from utils.redis.rkeys import MEMBER_SEND_COUPON_LIST  | 
            
| 14 | 15 | 
                 | 
            
                @@ -46,29 +47,35 @@ class Command(CompatibilityBaseCommand):  | 
            ||
| 46 | 47 | 
                rights = RightInfo.objects.filter(is_send_coupon=True, status=True)  | 
            
| 47 | 48 | 
                for right in rights:  | 
            
| 48 | 49 | 
                if user.level == UserInfo.MEMBER_LRC:  | 
            
| 49 | 
                - coupon_amount = right.coupon_level1_amount  | 
            |
| 50 | 
                + coupon_id = right.coupon_level1_id  | 
            |
| 50 | 51 | 
                elif user.level == UserInfo.MEMBER_SILVER:  | 
            
| 51 | 
                - coupon_amount = right.coupon_level2_amount  | 
            |
| 52 | 
                + coupon_id = right.coupon_level2_id  | 
            |
| 52 | 53 | 
                elif user.level == UserInfo.MEMBER_SILVER:  | 
            
| 53 | 
                - coupon_amount = right.coupon_level3_amount  | 
            |
| 54 | 
                + coupon_id = right.coupon_level3_id  | 
            |
| 54 | 55 | 
                elif user.level == UserInfo.MEMBER_SILVER:  | 
            
| 55 | 
                - coupon_amount = right.coupon_level4_amount  | 
            |
| 56 | 
                + coupon_id = right.coupon_level4_id  | 
            |
| 56 | 57 | 
                else:  | 
            
| 57 | 
                - coupon_amount = right.coupon_level5_amount  | 
            |
| 58 | 
                + coupon_id = right.coupon_level5_id  | 
            |
| 59 | 
                +  | 
            |
| 60 | 
                + try:  | 
            |
| 61 | 
                + coupon = UserCouponInfo.objects.get(coupon_id=coupon_id)  | 
            |
| 62 | 
                + except UserCouponInfo.DoesNotExist:  | 
            |
| 63 | 
                + continue  | 
            |
| 64 | 
                +  | 
            |
| 58 | 65 | 
                for _ in xrange(right.coupon_num):  | 
            
| 59 | 
                - CouponInfo.objects.create(  | 
            |
| 66 | 
                + UserCouponInfo.objects.create(  | 
            |
| 67 | 
                + brand_id=coupon.brand_id,  | 
            |
| 68 | 
                + brand_name=coupon.brand_name,  | 
            |
| 69 | 
                + coupon_id=coupon_id,  | 
            |
| 60 | 70 | 
                user_id=user_id,  | 
            
| 61 | 
                - coupon_valid_period=right.coupon_valid_period,  | 
            |
| 62 | 
                - coupon_amount=coupon_amount,  | 
            |
| 63 | 
                - coupon_detail=right.coupon_detail,  | 
            |
| 71 | 
                + coupon_title=coupon.coupon_title,  | 
            |
| 72 | 
                + coupon_detail=coupon.coupon_detail,  | 
            |
| 73 | 
                + coupon_value=coupon.coupon_value,  | 
            |
| 74 | 
                + coupon_image=coupon.coupon_image,  | 
            |
| 64 | 75 | 
                active_at=tc.utc_datetime(),  | 
            
| 65 | 76 | 
                expire_at=tc.utc_datetime(days=365),  | 
            
| 66 | 
                - right_id=right.right_id,  | 
            |
| 67 | 
                - right_type=right.right_type,  | 
            |
| 68 | 
                - icon=right.icon,  | 
            |
| 69 | 
                - title=right.title,  | 
            |
| 70 | 
                - subtitle=right.subtitle,  | 
            |
| 71 | 
                - detail=right.detail,  | 
            |
| 77 | 
                + coupon_valid_period=coupon.coupon_valid_period,  | 
            |
| 78 | 
                + coupon_limit_brand_ids=coupon.coupon_limit_brand_ids,  | 
            |
| 72 | 79 | 
                )  | 
            
| 73 | 80 | 
                 | 
            
| 74 | 81 | 
                close_old_connections()  | 
            
                @@ -2,27 +2,14 @@  | 
            ||
| 2 | 2 | 
                 | 
            
| 3 | 3 | 
                from django.contrib import admin  | 
            
| 4 | 4 | 
                 | 
            
| 5 | 
                -from coupon.models import CouponInfo  | 
            |
| 5 | 
                +from coupon.models import CouponInfo, UserCouponInfo  | 
            |
| 6 | 6 | 
                from mch.models import ActivityInfo  | 
            
| 7 | 7 | 
                from member.models import RightInfo  | 
            
| 8 | 8 | 
                 | 
            
| 9 | 9 | 
                 | 
            
| 10 | 10 | 
                class CouponInfoAdmin(admin.ModelAdmin):  | 
            
| 11 | 
                -    list_display = ('coupon_id', 'coupon_expire_type', 'coupon_valid_period', 'coupon_expire_at', 'coupon_value', 'coupon_num', 'coupon_level1_amount', 'coupon_level2_amount', 'coupon_level3_amount', 'coupon_level4_amount', 'coupon_level5_amount', 'coupon_detail', 'status', 'created_at', 'updated_at')
               | 
            |
| 11 | 
                +    list_display = ('brand_id', 'brand_name', 'coupon_id', 'coupon_title', 'coupon_value', 'coupon_expire_type', 'coupon_valid_period', 'coupon_expire_at', 'status', 'created_at', 'updated_at')
               | 
            |
| 12 | 12 | 
                     readonly_fields = ('coupon_id', 'created_at', 'updated_at')
               | 
            
| 13 | 
                - fieldsets = (  | 
            |
| 14 | 
                -        (u'', {
               | 
            |
| 15 | 
                -            'fields': ('coupon_id', 'status', 'created_at', 'updated_at')
               | 
            |
| 16 | 
                - }),  | 
            |
| 17 | 
                -        (u'活动券信息', {
               | 
            |
| 18 | 
                -            'classes': ('collapse', ),
               | 
            |
| 19 | 
                -            'fields': ('coupon_expire_type', 'coupon_valid_period', 'coupon_expire_at', 'coupon_value')
               | 
            |
| 20 | 
                - }),  | 
            |
| 21 | 
                -        (u'会员券信息', {
               | 
            |
| 22 | 
                -            'classes': ('collapse', ),
               | 
            |
| 23 | 
                -            'fields': ('coupon_num', 'coupon_level1_amount', 'coupon_level2_amount', 'coupon_level3_amount', 'coupon_level4_amount', 'coupon_level5_amount', 'coupon_detail')
               | 
            |
| 24 | 
                - }),  | 
            |
| 25 | 
                - )  | 
            |
| 26 | 13 | 
                 | 
            
| 27 | 14 | 
                def save_model(self, request, obj, form, change):  | 
            
| 28 | 15 | 
                obj.save()  | 
            
                @@ -30,4 +17,10 @@ class CouponInfoAdmin(admin.ModelAdmin):  | 
            ||
| 30 | 17 | 
                # TODO: Update ActivityInfo/RightInfo  | 
            
| 31 | 18 | 
                 | 
            
| 32 | 19 | 
                 | 
            
| 20 | 
                +class UserCouponInfoAdmin(admin.ModelAdmin):  | 
            |
| 21 | 
                +    list_display = ('brand_id', 'brand_name', 'coupon_id', 'user_id', 'coupon_title', 'coupon_value', 'active_at', 'expire_at', 'coupon_valid_period', 'coupon_limit_brand_ids', 'has_used', 'admin_id', 'used_at', 'status', 'created_at', 'updated_at')
               | 
            |
| 22 | 
                +    list_filter = ('has_used', 'status')
               | 
            |
| 23 | 
                +  | 
            |
| 24 | 
                +  | 
            |
| 33 | 25 | 
                admin.site.register(CouponInfo, CouponInfoAdmin)  | 
            
| 26 | 
                +admin.site.register(UserCouponInfo, UserCouponInfoAdmin)  | 
            
                @@ -0,0 +1,56 @@  | 
            ||
| 1 | 
                +# -*- coding: utf-8 -*-  | 
            |
| 2 | 
                +# Generated by Django 1.11.26 on 2019-12-21 07:34  | 
            |
| 3 | 
                +from __future__ import unicode_literals  | 
            |
| 4 | 
                +  | 
            |
| 5 | 
                +from django.db import migrations, models  | 
            |
| 6 | 
                +import django_models_ext.fileext  | 
            |
| 7 | 
                +import jsonfield.fields  | 
            |
| 8 | 
                +  | 
            |
| 9 | 
                +  | 
            |
| 10 | 
                +class Migration(migrations.Migration):  | 
            |
| 11 | 
                +  | 
            |
| 12 | 
                + dependencies = [  | 
            |
| 13 | 
                +        ('coupon', '0001_initial'),
               | 
            |
| 14 | 
                + ]  | 
            |
| 15 | 
                +  | 
            |
| 16 | 
                + operations = [  | 
            |
| 17 | 
                + migrations.RemoveField(  | 
            |
| 18 | 
                + model_name='couponinfo',  | 
            |
| 19 | 
                + name='coupon_level1_amount',  | 
            |
| 20 | 
                + ),  | 
            |
| 21 | 
                + migrations.RemoveField(  | 
            |
| 22 | 
                + model_name='couponinfo',  | 
            |
| 23 | 
                + name='coupon_level2_amount',  | 
            |
| 24 | 
                + ),  | 
            |
| 25 | 
                + migrations.RemoveField(  | 
            |
| 26 | 
                + model_name='couponinfo',  | 
            |
| 27 | 
                + name='coupon_level3_amount',  | 
            |
| 28 | 
                + ),  | 
            |
| 29 | 
                + migrations.RemoveField(  | 
            |
| 30 | 
                + model_name='couponinfo',  | 
            |
| 31 | 
                + name='coupon_level4_amount',  | 
            |
| 32 | 
                + ),  | 
            |
| 33 | 
                + migrations.RemoveField(  | 
            |
| 34 | 
                + model_name='couponinfo',  | 
            |
| 35 | 
                + name='coupon_level5_amount',  | 
            |
| 36 | 
                + ),  | 
            |
| 37 | 
                + migrations.RemoveField(  | 
            |
| 38 | 
                + model_name='couponinfo',  | 
            |
| 39 | 
                + name='coupon_num',  | 
            |
| 40 | 
                + ),  | 
            |
| 41 | 
                + migrations.AddField(  | 
            |
| 42 | 
                + model_name='couponinfo',  | 
            |
| 43 | 
                + name='coupon_image',  | 
            |
| 44 | 
                + field=models.ImageField(blank=True, help_text='\u5238\u56fe\u7247', null=True, upload_to=django_models_ext.fileext.upload_path, verbose_name='coupon_image'),  | 
            |
| 45 | 
                + ),  | 
            |
| 46 | 
                + migrations.AddField(  | 
            |
| 47 | 
                + model_name='couponinfo',  | 
            |
| 48 | 
                + name='coupon_limit_brand_ids',  | 
            |
| 49 | 
                + field=jsonfield.fields.JSONField(blank=True, help_text='\u5238\u9650\u5236\u4f7f\u7528 brand_ids', null=True, verbose_name='coupon_limit_brand_ids'),  | 
            |
| 50 | 
                + ),  | 
            |
| 51 | 
                + migrations.AddField(  | 
            |
| 52 | 
                + model_name='couponinfo',  | 
            |
| 53 | 
                + name='coupon_title',  | 
            |
| 54 | 
                + field=models.CharField(blank=True, help_text='\u5238\u6807\u9898', max_length=255, null=True, verbose_name='coupon_title'),  | 
            |
| 55 | 
                + ),  | 
            |
| 56 | 
                + ]  | 
            
                @@ -0,0 +1,55 @@  | 
            ||
| 1 | 
                +# -*- coding: utf-8 -*-  | 
            |
| 2 | 
                +# Generated by Django 1.11.26 on 2019-12-21 08:13  | 
            |
| 3 | 
                +from __future__ import unicode_literals  | 
            |
| 4 | 
                +  | 
            |
| 5 | 
                +from django.db import migrations, models  | 
            |
| 6 | 
                +import jsonfield.fields  | 
            |
| 7 | 
                +import shortuuidfield.fields  | 
            |
| 8 | 
                +import simditor.fields  | 
            |
| 9 | 
                +  | 
            |
| 10 | 
                +  | 
            |
| 11 | 
                +class Migration(migrations.Migration):  | 
            |
| 12 | 
                +  | 
            |
| 13 | 
                + dependencies = [  | 
            |
| 14 | 
                +        ('coupon', '0002_auto_20191221_1534'),
               | 
            |
| 15 | 
                + ]  | 
            |
| 16 | 
                +  | 
            |
| 17 | 
                + operations = [  | 
            |
| 18 | 
                + migrations.CreateModel(  | 
            |
| 19 | 
                + name='UserCouponInfo',  | 
            |
| 20 | 
                + fields=[  | 
            |
| 21 | 
                +                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
               | 
            |
| 22 | 
                +                ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
               | 
            |
| 23 | 
                +                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
               | 
            |
| 24 | 
                +                ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
               | 
            |
| 25 | 
                +                ('brand_id', models.CharField(blank=True, db_index=True, help_text='\u54c1\u724c\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='brand_id')),
               | 
            |
| 26 | 
                +                ('brand_name', models.CharField(blank=True, help_text='\u54c1\u724c\u540d\u79f0', max_length=255, null=True, verbose_name='brand_name')),
               | 
            |
| 27 | 
                +                ('coupon_id', shortuuidfield.fields.ShortUUIDField(blank=True, db_index=True, editable=False, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=22, null=True, unique=True)),
               | 
            |
| 28 | 
                +                ('user_id', models.CharField(blank=True, db_index=True, help_text='\u7528\u6237\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='user_id')),
               | 
            |
| 29 | 
                +                ('coupon_title', models.CharField(blank=True, help_text='\u5238\u6807\u9898', max_length=255, null=True, verbose_name='coupon_title')),
               | 
            |
| 30 | 
                +                ('coupon_detail', simditor.fields.RichTextField(blank=True, help_text='\u5238\u8be6\u60c5', null=True, verbose_name='coupon_detail')),
               | 
            |
| 31 | 
                +                ('coupon_value', models.IntegerField(blank=True, default=0, help_text='\u5238\u91d1\u989d\uff08\u5355\u4f4d\uff1a\u5206\uff09', null=True, verbose_name='coupon_value')),
               | 
            |
| 32 | 
                +                ('active_at', models.DateTimeField(blank=True, help_text='\u751f\u6548\u65f6\u95f4', null=True, verbose_name='active_at')),
               | 
            |
| 33 | 
                +                ('expire_at', models.DateTimeField(blank=True, help_text='\u8fc7\u671f\u65f6\u95f4', null=True, verbose_name='expire_at')),
               | 
            |
| 34 | 
                +                ('coupon_valid_period', models.IntegerField(default=0, help_text='\u5238\u6709\u6548\u65f6\u95f4\uff08\u5355\u4f4d\uff1a\u5929\uff09', verbose_name='coupon_valid_period')),
               | 
            |
| 35 | 
                +                ('coupon_limit_brand_ids', jsonfield.fields.JSONField(blank=True, help_text='\u5238\u9650\u5236\u4f7f\u7528 brand_ids', null=True, verbose_name='coupon_limit_brand_ids')),
               | 
            |
| 36 | 
                +                ('has_used', models.BooleanField(db_index=True, default=False, help_text='\u662f\u5426\u5df2\u6838\u9500', verbose_name='has_used')),
               | 
            |
| 37 | 
                +                ('admin_id', models.CharField(blank=True, db_index=True, help_text='\u6838\u9500\u5458\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='admin_id')),
               | 
            |
| 38 | 
                +                ('used_at', models.DateTimeField(blank=True, help_text='\u7ef4\u4fee\u5238\u6838\u9500\u65f6\u95f4', null=True, verbose_name='used_at')),
               | 
            |
| 39 | 
                + ],  | 
            |
| 40 | 
                +            options={
               | 
            |
| 41 | 
                + 'verbose_name': '\u7528\u6237\u5238\u4fe1\u606f',  | 
            |
| 42 | 
                + 'verbose_name_plural': '\u7528\u6237\u5238\u4fe1\u606f',  | 
            |
| 43 | 
                + },  | 
            |
| 44 | 
                + ),  | 
            |
| 45 | 
                + migrations.AddField(  | 
            |
| 46 | 
                + model_name='couponinfo',  | 
            |
| 47 | 
                + name='brand_id',  | 
            |
| 48 | 
                + field=models.CharField(blank=True, db_index=True, help_text='\u54c1\u724c\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='brand_id'),  | 
            |
| 49 | 
                + ),  | 
            |
| 50 | 
                + migrations.AddField(  | 
            |
| 51 | 
                + model_name='couponinfo',  | 
            |
| 52 | 
                + name='brand_name',  | 
            |
| 53 | 
                + field=models.CharField(blank=True, help_text='\u54c1\u724c\u540d\u79f0', max_length=255, null=True, verbose_name='brand_name'),  | 
            |
| 54 | 
                + ),  | 
            |
| 55 | 
                + ]  | 
            
                @@ -2,8 +2,10 @@  | 
            ||
| 2 | 2 | 
                 | 
            
| 3 | 3 | 
                from django.db import models  | 
            
| 4 | 4 | 
                from django.utils.translation import ugettext_lazy as _  | 
            
| 5 | 
                -from django_models_ext import BaseModelMixin  | 
            |
| 5 | 
                +from django_models_ext import BaseModelMixin, upload_file_path, upload_file_url, upload_path  | 
            |
| 6 | 
                +from jsonfield import JSONField  | 
            |
| 6 | 7 | 
                from shortuuidfield import ShortUUIDField  | 
            
| 8 | 
                +from TimeConvert import TimeConvert as tc  | 
            |
| 7 | 9 | 
                 | 
            
| 8 | 10 | 
                from simditor.fields import RichTextField  | 
            
| 9 | 11 | 
                 | 
            
                @@ -17,22 +19,21 @@ class CouponInfo(BaseModelMixin):  | 
            ||
| 17 | 19 | 
                (CHANGED_EXPIRED_TIME, u'可变结束时间'),  | 
            
| 18 | 20 | 
                )  | 
            
| 19 | 21 | 
                 | 
            
| 22 | 
                + brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)  | 
            |
| 23 | 
                + brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')  | 
            |
| 24 | 
                +  | 
            |
| 20 | 25 | 
                coupon_id = ShortUUIDField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True, unique=True)  | 
            
| 21 | 26 | 
                 | 
            
| 22 | 
                - # 活动券信息  | 
            |
| 27 | 
                + coupon_title = models.CharField(_(u'coupon_title'), max_length=255, blank=True, null=True, help_text=u'券标题')  | 
            |
| 28 | 
                + coupon_detail = RichTextField(_(u'coupon_detail'), blank=True, null=True, help_text=u'券详情')  | 
            |
| 29 | 
                + coupon_value = models.IntegerField(_(u'coupon_value'), default=0, help_text=_(u'维修券金额(单位:分)'))  | 
            |
| 30 | 
                + coupon_image = models.ImageField(_(u'coupon_image'), upload_to=upload_path, blank=True, null=True, help_text=u'券图片')  | 
            |
| 31 | 
                +  | 
            |
| 23 | 32 | 
                coupon_expire_type = models.IntegerField(_(u'coupon_expire_type'), choices=COUPON_EXPIRED_TIME_TUPLE, default=FIXED_EXPIRED_TIME, help_text=_(u'维修券类型'))  | 
            
| 24 | 33 | 
                coupon_valid_period = models.IntegerField(_(u'coupon_valid_period'), default=0, help_text=_(u'维修券有效时间(单位:天)'))  | 
            
| 25 | 34 | 
                coupon_expire_at = models.DateTimeField(_(u'coupon_expire_at'), blank=True, null=True, help_text=_(u'维修券过期时间'))  | 
            
| 26 | 
                - coupon_value = models.IntegerField(_(u'coupon_value'), default=0, help_text=_(u'维修券金额(单位:分)'))  | 
            |
| 27 | 35 | 
                 | 
            
| 28 | 
                - # 会员券信息  | 
            |
| 29 | 
                - coupon_num = models.IntegerField(_(u'coupon_num'), default=0, help_text=_(u'券每会员级别发放张数'))  | 
            |
| 30 | 
                - coupon_level1_amount = models.IntegerField(_(u'coupon_level1_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)')  | 
            |
| 31 | 
                - coupon_level2_amount = models.IntegerField(_(u'coupon_level2_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)')  | 
            |
| 32 | 
                - coupon_level3_amount = models.IntegerField(_(u'coupon_level3_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)')  | 
            |
| 33 | 
                - coupon_level4_amount = models.IntegerField(_(u'coupon_level4_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)')  | 
            |
| 34 | 
                - coupon_level5_amount = models.IntegerField(_(u'coupon_level5_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)')  | 
            |
| 35 | 
                - coupon_detail = RichTextField(_(u'coupon_detail'), blank=True, null=True, help_text=u'券详情')  | 
            |
| 36 | 
                + coupon_limit_brand_ids = JSONField(_(u'coupon_limit_brand_ids'), blank=True, null=True, help_text=u'券限制使用 brand_ids')  | 
            |
| 36 | 37 | 
                 | 
            
| 37 | 38 | 
                class Meta:  | 
            
| 38 | 39 | 
                verbose_name = _(u'券信息')  | 
            
                @@ -40,3 +41,59 @@ class CouponInfo(BaseModelMixin):  | 
            ||
| 40 | 41 | 
                 | 
            
| 41 | 42 | 
                def __unicode__(self):  | 
            
| 42 | 43 | 
                return unicode(self.pk)  | 
            
| 44 | 
                +  | 
            |
| 45 | 
                +  | 
            |
| 46 | 
                +class UserCouponInfo(BaseModelMixin):  | 
            |
| 47 | 
                + brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)  | 
            |
| 48 | 
                + brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')  | 
            |
| 49 | 
                +  | 
            |
| 50 | 
                + coupon_id = ShortUUIDField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True, unique=True)  | 
            |
| 51 | 
                + user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)  | 
            |
| 52 | 
                +  | 
            |
| 53 | 
                + coupon_title = models.CharField(_(u'coupon_title'), max_length=255, blank=True, null=True, help_text=u'券标题')  | 
            |
| 54 | 
                + coupon_detail = RichTextField(_(u'coupon_detail'), blank=True, null=True, help_text=u'券详情')  | 
            |
| 55 | 
                + coupon_value = models.IntegerField(_(u'coupon_value'), default=0, blank=True, null=True, help_text=u'券金额(单位:分)')  | 
            |
| 56 | 
                + coupon_image = models.ImageField(_(u'coupon_image'), upload_to=upload_path, blank=True, null=True, help_text=u'券图片')  | 
            |
| 57 | 
                +  | 
            |
| 58 | 
                + active_at = models.DateTimeField(_(u'active_at'), blank=True, null=True, help_text=_(u'生效时间'))  | 
            |
| 59 | 
                + expire_at = models.DateTimeField(_(u'expire_at'), blank=True, null=True, help_text=_(u'过期时间'))  | 
            |
| 60 | 
                + coupon_valid_period = models.IntegerField(_(u'coupon_valid_period'), default=0, help_text=_(u'券有效时间(单位:天)'))  | 
            |
| 61 | 
                +  | 
            |
| 62 | 
                + coupon_limit_brand_ids = JSONField(_(u'coupon_limit_brand_ids'), blank=True, null=True, help_text=u'券限制使用 brand_ids')  | 
            |
| 63 | 
                +  | 
            |
| 64 | 
                + has_used = models.BooleanField(_(u'has_used'), default=False, help_text=u'是否已核销', db_index=True)  | 
            |
| 65 | 
                + admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'核销员唯一标识', db_index=True)  | 
            |
| 66 | 
                + used_at = models.DateTimeField(_(u'used_at'), blank=True, null=True, help_text=u'维修券核销时间')  | 
            |
| 67 | 
                +  | 
            |
| 68 | 
                + class Meta:  | 
            |
| 69 | 
                + verbose_name = _(u'用户券信息')  | 
            |
| 70 | 
                + verbose_name_plural = _(u'用户券信息')  | 
            |
| 71 | 
                +  | 
            |
| 72 | 
                + def __unicode__(self):  | 
            |
| 73 | 
                + return unicode(self.pk)  | 
            |
| 74 | 
                +  | 
            |
| 75 | 
                + @property  | 
            |
| 76 | 
                + def coupon_image(self):  | 
            |
| 77 | 
                + return upload_file_path(self.coupon_image)  | 
            |
| 78 | 
                +  | 
            |
| 79 | 
                + @property  | 
            |
| 80 | 
                + def coupon_image_url(self):  | 
            |
| 81 | 
                + return upload_file_url(self.coupon_image)  | 
            |
| 82 | 
                +  | 
            |
| 83 | 
                + @property  | 
            |
| 84 | 
                + def data(self):  | 
            |
| 85 | 
                +        return {
               | 
            |
| 86 | 
                + 'coupon_id': self.coupon_id,  | 
            |
| 87 | 
                + 'coupon_title': self.coupon_title,  | 
            |
| 88 | 
                + 'coupon_detail': self.coupon_detail,  | 
            |
| 89 | 
                + 'coupon_amount': self.coupon_value,  | 
            |
| 90 | 
                + 'coupon_value': self.coupon_value,  | 
            |
| 91 | 
                + 'coupon_image_url': self.coupon_image_url,  | 
            |
| 92 | 
                + 'active_at': tc.local_string(self.active_at, format='%Y%m%d'),  | 
            |
| 93 | 
                + 'expire_at': tc.local_string(self.expire_at, format='%Y%m%d'),  | 
            |
| 94 | 
                + 'coupon_valid_period': self.coupon_valid_period,  | 
            |
| 95 | 
                + 'coupon_limit_brand_ids': self.coupon_limit_brand_ids,  | 
            |
| 96 | 
                + 'has_used': self.has_used,  | 
            |
| 97 | 
                + 'admin_id': self.admin_id,  | 
            |
| 98 | 
                + 'used_at': self.used_at,  | 
            |
| 99 | 
                + }  | 
            
                @@ -2,13 +2,13 @@  | 
            ||
| 2 | 2 | 
                 | 
            
| 3 | 3 | 
                from django.contrib import admin  | 
            
| 4 | 4 | 
                 | 
            
| 5 | 
                -from member.models import (CouponInfo, GoodsInfo, GoodsOrderInfo, MemberActivityInfo, MemberActivitySigninInfo,  | 
            |
| 5 | 
                +from member.models import (GoodsInfo, GoodsOrderInfo, MemberActivityInfo, MemberActivitySigninInfo,  | 
            |
| 6 | 6 | 
                MemberActivitySignupInfo, RightInfo, ShotTypeInfo)  | 
            
| 7 | 7 | 
                from utils.redis.rshot import update_member_shot_data  | 
            
| 8 | 8 | 
                 | 
            
| 9 | 9 | 
                 | 
            
| 10 | 10 | 
                class GoodsInfoAdmin(admin.ModelAdmin):  | 
            
| 11 | 
                -    list_display = ('good_id', 'good_type', 'title', 'desc', 'image', 'is_slider', 'slider_image', 'integral', 'fee', 'minlevel', 'only_for_member', 'position', 'status', 'created_at', 'updated_at')
               | 
            |
| 11 | 
                +    list_display = ('good_id', 'good_type', 'title', 'value', 'left_num', 'coupon_id', 'image', 'is_slider', 'slider_image', 'integral', 'fee', 'minlevel', 'only_for_member', 'position', 'status', 'created_at', 'updated_at')
               | 
            |
| 12 | 12 | 
                     list_filter = ('good_type', 'is_slider', 'only_for_member', 'status')
               | 
            
| 13 | 13 | 
                 | 
            
| 14 | 14 | 
                 | 
            
                @@ -28,7 +28,7 @@ class GoodsOrderInfoAdmin(admin.ModelAdmin):  | 
            ||
| 28 | 28 | 
                 | 
            
| 29 | 29 | 
                 | 
            
| 30 | 30 | 
                class RightInfoAdmin(admin.ModelAdmin):  | 
            
| 31 | 
                -    list_display = ('right_id', 'right_type', 'icon', 'title', 'subtitle', 'detail', 'level1', 'level2', 'level3', 'level4', 'level5', 'minlevel', 'position', 'is_send_coupon', 'coupon_valid_period', 'coupon_num', 'status', 'created_at', 'updated_at')
               | 
            |
| 31 | 
                +    list_display = ('right_id', 'right_type', 'icon', 'title', 'subtitle', 'detail', 'level1', 'level2', 'level3', 'level4', 'level5', 'minlevel', 'position', 'is_send_coupon', 'coupon_num', 'coupon_level1_id', 'coupon_level2_id', 'coupon_level3_id', 'status', 'created_at', 'updated_at')
               | 
            |
| 32 | 32 | 
                     list_filter = ('right_type', 'is_send_coupon', 'status')
               | 
            
| 33 | 33 | 
                 | 
            
| 34 | 34 | 
                def save_model(self, request, obj, form, change):  | 
            
                @@ -37,11 +37,6 @@ class RightInfoAdmin(admin.ModelAdmin):  | 
            ||
| 37 | 37 | 
                # TODO: Update coupon relative  | 
            
| 38 | 38 | 
                 | 
            
| 39 | 39 | 
                 | 
            
| 40 | 
                -class CouponInfoAdmin(admin.ModelAdmin):  | 
            |
| 41 | 
                -    list_display = ('coupon_id', 'user_id', 'coupon_valid_period', 'coupon_amount', 'coupon_detail', 'active_at', 'expire_at', 'right_id', 'right_type', 'icon', 'title', 'subtitle', 'detail', 'status', 'created_at', 'updated_at')
               | 
            |
| 42 | 
                -    list_filter = ('right_type', 'status')
               | 
            |
| 43 | 
                -  | 
            |
| 44 | 
                -  | 
            |
| 45 | 40 | 
                class ShotTypeInfoAdmin(admin.ModelAdmin):  | 
            
| 46 | 41 | 
                     list_display = ('shot_type_id', 'shot_type_name', 'position', 'status', 'created_at', 'updated_at')
               | 
            
| 47 | 42 | 
                 | 
            
                @@ -74,7 +69,6 @@ class MemberActivitySigninInfoAdmin(admin.ModelAdmin):  | 
            ||
| 74 | 69 | 
                admin.site.register(GoodsInfo, GoodsInfoAdmin)  | 
            
| 75 | 70 | 
                admin.site.register(GoodsOrderInfo, GoodsOrderInfoAdmin)  | 
            
| 76 | 71 | 
                admin.site.register(RightInfo, RightInfoAdmin)  | 
            
| 77 | 
                -admin.site.register(CouponInfo, CouponInfoAdmin)  | 
            |
| 78 | 72 | 
                admin.site.register(ShotTypeInfo, ShotTypeInfoAdmin)  | 
            
| 79 | 73 | 
                admin.site.register(MemberActivityInfo, MemberActivityInfoAdmin)  | 
            
| 80 | 74 | 
                admin.site.register(MemberActivitySignupInfo, MemberActivitySignupInfoAdmin)  | 
            
                @@ -0,0 +1,90 @@  | 
            ||
| 1 | 
                +# -*- coding: utf-8 -*-  | 
            |
| 2 | 
                +# Generated by Django 1.11.26 on 2019-12-21 08:13  | 
            |
| 3 | 
                +from __future__ import unicode_literals  | 
            |
| 4 | 
                +  | 
            |
| 5 | 
                +from django.db import migrations, models  | 
            |
| 6 | 
                +  | 
            |
| 7 | 
                +  | 
            |
| 8 | 
                +class Migration(migrations.Migration):  | 
            |
| 9 | 
                +  | 
            |
| 10 | 
                + dependencies = [  | 
            |
| 11 | 
                +        ('member', '0013_goodsinfo_only_for_member'),
               | 
            |
| 12 | 
                + ]  | 
            |
| 13 | 
                +  | 
            |
| 14 | 
                + operations = [  | 
            |
| 15 | 
                + migrations.DeleteModel(  | 
            |
| 16 | 
                + name='CouponInfo',  | 
            |
| 17 | 
                + ),  | 
            |
| 18 | 
                + migrations.RemoveField(  | 
            |
| 19 | 
                + model_name='rightinfo',  | 
            |
| 20 | 
                + name='coupon_detail',  | 
            |
| 21 | 
                + ),  | 
            |
| 22 | 
                + migrations.RemoveField(  | 
            |
| 23 | 
                + model_name='rightinfo',  | 
            |
| 24 | 
                + name='coupon_id',  | 
            |
| 25 | 
                + ),  | 
            |
| 26 | 
                + migrations.RemoveField(  | 
            |
| 27 | 
                + model_name='rightinfo',  | 
            |
| 28 | 
                + name='coupon_level1_amount',  | 
            |
| 29 | 
                + ),  | 
            |
| 30 | 
                + migrations.RemoveField(  | 
            |
| 31 | 
                + model_name='rightinfo',  | 
            |
| 32 | 
                + name='coupon_level2_amount',  | 
            |
| 33 | 
                + ),  | 
            |
| 34 | 
                + migrations.RemoveField(  | 
            |
| 35 | 
                + model_name='rightinfo',  | 
            |
| 36 | 
                + name='coupon_level3_amount',  | 
            |
| 37 | 
                + ),  | 
            |
| 38 | 
                + migrations.RemoveField(  | 
            |
| 39 | 
                + model_name='rightinfo',  | 
            |
| 40 | 
                + name='coupon_level4_amount',  | 
            |
| 41 | 
                + ),  | 
            |
| 42 | 
                + migrations.RemoveField(  | 
            |
| 43 | 
                + model_name='rightinfo',  | 
            |
| 44 | 
                + name='coupon_level5_amount',  | 
            |
| 45 | 
                + ),  | 
            |
| 46 | 
                + migrations.RemoveField(  | 
            |
| 47 | 
                + model_name='rightinfo',  | 
            |
| 48 | 
                + name='coupon_valid_period',  | 
            |
| 49 | 
                + ),  | 
            |
| 50 | 
                + migrations.AddField(  | 
            |
| 51 | 
                + model_name='goodsinfo',  | 
            |
| 52 | 
                + name='coupon_id',  | 
            |
| 53 | 
                + field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_id'),  | 
            |
| 54 | 
                + ),  | 
            |
| 55 | 
                + migrations.AddField(  | 
            |
| 56 | 
                + model_name='goodsinfo',  | 
            |
| 57 | 
                + name='left_num',  | 
            |
| 58 | 
                + field=models.IntegerField(default=0, help_text='\u5546\u54c1\u5e93\u5b58', verbose_name='left_num'),  | 
            |
| 59 | 
                + ),  | 
            |
| 60 | 
                + migrations.AddField(  | 
            |
| 61 | 
                + model_name='goodsinfo',  | 
            |
| 62 | 
                + name='value',  | 
            |
| 63 | 
                + field=models.IntegerField(default=99999, help_text='\u5546\u54c1\u4ef7\u503c\uff0c\u5355\u4f4d\u5206', verbose_name='value'),  | 
            |
| 64 | 
                + ),  | 
            |
| 65 | 
                + migrations.AddField(  | 
            |
| 66 | 
                + model_name='rightinfo',  | 
            |
| 67 | 
                + name='coupon_level1_id',  | 
            |
| 68 | 
                + field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_level1_id'),  | 
            |
| 69 | 
                + ),  | 
            |
| 70 | 
                + migrations.AddField(  | 
            |
| 71 | 
                + model_name='rightinfo',  | 
            |
| 72 | 
                + name='coupon_level2_id',  | 
            |
| 73 | 
                + field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_level2_id'),  | 
            |
| 74 | 
                + ),  | 
            |
| 75 | 
                + migrations.AddField(  | 
            |
| 76 | 
                + model_name='rightinfo',  | 
            |
| 77 | 
                + name='coupon_level3_id',  | 
            |
| 78 | 
                + field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_level3_id'),  | 
            |
| 79 | 
                + ),  | 
            |
| 80 | 
                + migrations.AddField(  | 
            |
| 81 | 
                + model_name='rightinfo',  | 
            |
| 82 | 
                + name='coupon_level4_id',  | 
            |
| 83 | 
                + field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_level4_id'),  | 
            |
| 84 | 
                + ),  | 
            |
| 85 | 
                + migrations.AddField(  | 
            |
| 86 | 
                + model_name='rightinfo',  | 
            |
| 87 | 
                + name='coupon_level5_id',  | 
            |
| 88 | 
                + field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_level5_id'),  | 
            |
| 89 | 
                + ),  | 
            |
| 90 | 
                + ]  | 
            
                @@ -27,9 +27,13 @@ class GoodsInfo(BaseModelMixin):  | 
            ||
| 27 | 27 | 
                 | 
            
| 28 | 28 | 
                title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'商品名称')  | 
            
| 29 | 29 | 
                desc = RichTextField(_(u'desc'), blank=True, null=True, help_text=u'商品描述')  | 
            
| 30 | 
                + value = models.IntegerField(_(u'value'), default=99999, help_text=u'商品价值,单位分')  | 
            |
| 31 | 
                + left_num = models.IntegerField(_(u'left_num'), default=0, help_text=u'商品库存')  | 
            |
| 30 | 32 | 
                 | 
            
| 31 | 33 | 
                image = models.ImageField(_(u'image'), upload_to=upload_path, blank=True, null=True, help_text=u'商品图片')  | 
            
| 32 | 34 | 
                 | 
            
| 35 | 
                + coupon_id = models.CharField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True)  | 
            |
| 36 | 
                +  | 
            |
| 33 | 37 | 
                is_slider = models.BooleanField(_(u'is_slider'), default=True, help_text=u'是否为轮播商品', db_index=True)  | 
            
| 34 | 38 | 
                slider_image = models.ImageField(_(u'slider_image'), upload_to=upload_path, blank=True, null=True, help_text=u'商品轮播图片')  | 
            
| 35 | 39 | 
                 | 
            
                @@ -164,17 +168,12 @@ class RightInfo(BaseModelMixin):  | 
            ||
| 164 | 168 | 
                 | 
            
| 165 | 169 | 
                # 券相关  | 
            
| 166 | 170 | 
                is_send_coupon = models.BooleanField(_(u'is_send_coupon'), default=False, help_text=_(u'是否发券'), db_index=True)  | 
            
| 167 | 
                -  | 
            |
| 168 | 
                - coupon_id = models.CharField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True)  | 
            |
| 169 | 
                -  | 
            |
| 170 | 
                - coupon_valid_period = models.IntegerField(_(u'coupon_valid_period'), default=0, help_text=_(u'券有效时间(单位:天)'))  | 
            |
| 171 | 171 | 
                coupon_num = models.IntegerField(_(u'coupon_num'), default=0, help_text=_(u'券每会员级别发放张数'))  | 
            
| 172 | 
                - coupon_level1_amount = models.IntegerField(_(u'coupon_level1_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)')  | 
            |
| 173 | 
                - coupon_level2_amount = models.IntegerField(_(u'coupon_level2_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)')  | 
            |
| 174 | 
                - coupon_level3_amount = models.IntegerField(_(u'coupon_level3_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)')  | 
            |
| 175 | 
                - coupon_level4_amount = models.IntegerField(_(u'coupon_level4_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)')  | 
            |
| 176 | 
                - coupon_level5_amount = models.IntegerField(_(u'coupon_level5_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)')  | 
            |
| 177 | 
                - coupon_detail = RichTextField(_(u'coupon_detail'), blank=True, null=True, help_text=u'券详情')  | 
            |
| 172 | 
                + coupon_level1_id = models.CharField(_(u'coupon_level1_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True)  | 
            |
| 173 | 
                + coupon_level2_id = models.CharField(_(u'coupon_level2_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True)  | 
            |
| 174 | 
                + coupon_level3_id = models.CharField(_(u'coupon_level3_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True)  | 
            |
| 175 | 
                + coupon_level4_id = models.CharField(_(u'coupon_level4_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True)  | 
            |
| 176 | 
                + coupon_level5_id = models.CharField(_(u'coupon_level5_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True)  | 
            |
| 178 | 177 | 
                 | 
            
| 179 | 178 | 
                class Meta:  | 
            
| 180 | 179 | 
                verbose_name = _(u'会员权益信息')  | 
            
                @@ -212,78 +211,6 @@ class RightInfo(BaseModelMixin):  | 
            ||
| 212 | 211 | 
                }  | 
            
| 213 | 212 | 
                 | 
            
| 214 | 213 | 
                 | 
            
| 215 | 
                -class CouponInfo(BaseModelMixin):  | 
            |
| 216 | 
                - PHYSICAL = 0  | 
            |
| 217 | 
                - VIRTUAL = 1  | 
            |
| 218 | 
                - COUPON = 2  | 
            |
| 219 | 
                -  | 
            |
| 220 | 
                - RIGHT_TYPE_TUPLE = (  | 
            |
| 221 | 
                - (PHYSICAL, u'实物'),  | 
            |
| 222 | 
                - (VIRTUAL, u'虚拟'),  | 
            |
| 223 | 
                - (COUPON, u'优惠券'),  | 
            |
| 224 | 
                - )  | 
            |
| 225 | 
                -  | 
            |
| 226 | 
                - brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)  | 
            |
| 227 | 
                - brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')  | 
            |
| 228 | 
                -  | 
            |
| 229 | 
                - coupon_id = ShortUUIDField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True, unique=True)  | 
            |
| 230 | 
                - user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)  | 
            |
| 231 | 
                -  | 
            |
| 232 | 
                - coupon_valid_period = models.IntegerField(_(u'coupon_valid_period'), default=0, help_text=_(u'券有效时间(单位:天)'))  | 
            |
| 233 | 
                - coupon_amount = models.IntegerField(_(u'coupon_amount'), default=0, blank=True, null=True, help_text=u'券金额(单位:分)')  | 
            |
| 234 | 
                - coupon_detail = RichTextField(_(u'coupon_detail'), blank=True, null=True, help_text=u'券详情')  | 
            |
| 235 | 
                -  | 
            |
| 236 | 
                - active_at = models.DateTimeField(_(u'active_at'), blank=True, null=True, help_text=_(u'生效时间'))  | 
            |
| 237 | 
                - expire_at = models.DateTimeField(_(u'expire_at'), blank=True, null=True, help_text=_(u'过期时间'))  | 
            |
| 238 | 
                -  | 
            |
| 239 | 
                - right_id = models.CharField(_(u'right_id'), max_length=32, blank=True, null=True, help_text=u'权益唯一标识', db_index=True)  | 
            |
| 240 | 
                - right_type = models.IntegerField(_(u'right_type'), choices=RIGHT_TYPE_TUPLE, default=VIRTUAL, help_text=u'权益类型', db_index=True)  | 
            |
| 241 | 
                -  | 
            |
| 242 | 
                - icon = models.ImageField(_(u'icon'), upload_to=upload_path, blank=True, null=True, help_text=u'权益图标')  | 
            |
| 243 | 
                - title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'权益名称')  | 
            |
| 244 | 
                - subtitle = models.CharField(_(u'subtitle'), max_length=255, blank=True, null=True, help_text=u'权益二级名称')  | 
            |
| 245 | 
                - detail = RichTextField(_(u'detail'), blank=True, null=True, help_text=u'权益详情')  | 
            |
| 246 | 
                -  | 
            |
| 247 | 
                - has_used = models.BooleanField(_(u'has_used'), default=False, help_text=u'是否已核销', db_index=True)  | 
            |
| 248 | 
                - admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'核销员唯一标识', db_index=True)  | 
            |
| 249 | 
                - used_at = models.DateTimeField(_(u'used_at'), blank=True, null=True, help_text=u'维修券核销时间')  | 
            |
| 250 | 
                -  | 
            |
| 251 | 
                - class Meta:  | 
            |
| 252 | 
                - verbose_name = _(u'会员券信息')  | 
            |
| 253 | 
                - verbose_name_plural = _(u'会员券信息')  | 
            |
| 254 | 
                -  | 
            |
| 255 | 
                - def __unicode__(self):  | 
            |
| 256 | 
                - return unicode(self.pk)  | 
            |
| 257 | 
                -  | 
            |
| 258 | 
                - @property  | 
            |
| 259 | 
                - def icon_path(self):  | 
            |
| 260 | 
                - return upload_file_path(self.icon)  | 
            |
| 261 | 
                -  | 
            |
| 262 | 
                - @property  | 
            |
| 263 | 
                - def icon_url(self):  | 
            |
| 264 | 
                - return upload_file_url(self.icon)  | 
            |
| 265 | 
                -  | 
            |
| 266 | 
                - @property  | 
            |
| 267 | 
                - def data(self):  | 
            |
| 268 | 
                -        return {
               | 
            |
| 269 | 
                - 'coupon_id': self.coupon_id,  | 
            |
| 270 | 
                - 'coupon_valid_period': self.coupon_valid_period,  | 
            |
| 271 | 
                - 'coupon_amount': self.coupon_amount,  | 
            |
| 272 | 
                - 'coupon_detail': self.coupon_detail,  | 
            |
| 273 | 
                - 'active_at': tc.local_string(self.active_at, format='%Y%m%d'),  | 
            |
| 274 | 
                - 'expire_at': tc.local_string(self.expire_at, format='%Y%m%d'),  | 
            |
| 275 | 
                - 'right_id': self.right_id,  | 
            |
| 276 | 
                - 'right_type': self.right_type,  | 
            |
| 277 | 
                - 'icon': self.icon_url,  | 
            |
| 278 | 
                - 'title': self.title,  | 
            |
| 279 | 
                - 'subtitle': self.subtitle,  | 
            |
| 280 | 
                - 'detail': self.detail,  | 
            |
| 281 | 
                - 'has_used': self.has_used,  | 
            |
| 282 | 
                - 'admin_id': self.admin_id,  | 
            |
| 283 | 
                - 'used_at': self.used_at,  | 
            |
| 284 | 
                - }  | 
            |
| 285 | 
                -  | 
            |
| 286 | 
                -  | 
            |
| 287 | 214 | 
                class ShotTypeInfo(BaseModelMixin):  | 
            
| 288 | 215 | 
                brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)  | 
            
| 289 | 216 | 
                brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')  |